翻訳と辞書
Words near each other
・ Gar Kandi
・ Gar Kandi Rasul Bakhsh Bazar
・ Gar Kandi, Khuzestan
・ Gar Kandi, Sistan and Baluchestan
・ Gar Knutson
・ Gar Kud
・ Gar Mangsham Sumnang
・ Gar mine
・ GAR Monument in Covington
・ Gar mosque and minaret
・ Gar Munara
・ Gar Pond
・ Gap Band VI
・ Gap Band VII
・ Gap Broadcasting Group
Gap buffer
・ Gap Cathedral
・ Gap Cave
・ Gap Civil Township, Alleghany County, North Carolina
・ Gap creationism
・ Gap Creek
・ Gap Dream
・ Gap dynamics
・ Gap FC
・ Gap financing
・ Gap Fire
・ Gap gene
・ Gap in Knob, Kentucky
・ Gap Inc.
・ GAP Insurance


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Gap buffer : ウィキペディア英語版
Gap buffer

A gap buffer in computer science is a dynamic array that allows efficient insertion and deletion operations clustered near the same location. Gap buffers are especially common in text editors, where most changes to the text occur at or near the current location of the cursor. The text is stored in a large buffer in two contiguous segments, with a gap between them for inserting new text. Moving the cursor involves copying text from one side of the gap to the other (sometimes copying is delayed until the next operation that changes the text). Insertion adds new text at the end of the first segment; deletion deletes it.
Text in a gap buffer is represented as two strings, which take very little extra space and which can be searched and displayed very quickly, compared to more sophisticated data structures such as linked lists. However, operations at different locations in the text and ones that fill the gap (requiring a new gap to be created) may require copying most of the text, which is especially inefficient for large files. The use of gap buffers is based on the assumption that such recopying occurs rarely enough that its cost can be amortized over the more common cheap operations. This makes the gap buffer a simpler alternative to the rope for use in text editors〔Mark C. Chu-Carroll. "(Gap Buffers, or, Don’t Get Tied Up With Ropes? )" ''ScienceBlogs'', 2009-02-18. Accessed 2013-01-30.〕 such as Emacs.〔(emacs gap buffer info ) Accessed 2013-01-30.〕
==Example==

Below are some examples of operations with buffer gaps. The gap is represented by the empty space between the square brackets. This representation is a bit misleading: in a typical implementation, the endpoints of the gap are tracked using pointers or array indices, and the contents of the gap are ignored; this allows, for example, deletions to be done by adjusting a pointer without changing the text in the buffer. It is a common programming practice to use a semi-open interval for the gap pointers, i.e. the start-of-gap points to the invalid character following the last character in the first buffer, and the end-of-gap points to the first valid character in the second buffer (or equivalently, the pointers are considered to point "between" characters).
Initial state:
This is the way ()out.
User inserts some new text:
This is the way the world started ()out.
User moves the cursor before "started"; system moves "started " from the first buffer to the second buffer.
This is the way the world ()started out.
User adds text filling the gap; system creates new gap:
This is the way the world as we know it ()started out.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Gap buffer」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.